package org.particles.gui;

import java.awt.event.ActionEvent;
import java.util.List;

import org.particles.domain.sim.SimParam;
import org.particles.domain.sim.SimulationCase;

public class GuiUtil {
	public static final String PROP_TASKRUN = "task.running";
	
	public static ActionEvent emptyActionEvent() {
		return null;
	}
	
	public static SimulationCase applyParametersToWorld(final SimCtrlPanel controlPanel) {
		// the order of simulation parameters and new values should be equal.
		final SimulationCase sim = controlPanel.getCurrentSimulation();
		final List<SimParam> simParams = sim.availableParams();
		final List<Double> newValues = controlPanel.getSimParams();
		assert simParams.size() == newValues.size() : "the lists must have same size";
		for(int i = 0; i < simParams.size(); i++) {
			sim.changeParam(simParams.get(i).getCode(), newValues.get(i));
		}
		return sim;
	}
}
